Apparatus for implementing actions based on packet classification and lookup results

ABSTRACT

A method and apparatus are provided for implementing predefined actions based upon packet classification and lookup results in a communications network processor. A plurality of sets of rules is defined. Each rule set includes at least one rule and each rule has a set of masked compares for comparing results of hits and misses of table lookups. Each masked compare set has an associated field for selecting an action. The action defines a set of one or more commands and each command defines a processing operation. One rule set is identified based upon the packet classification result for a received packet. When one of the rules is identified having a match of the masked compares, then the action of associated with the identified rule is selected. Otherwise a default action is provided responsive to no rule of the identified rule set having a match of the masked compares.

FIELD OF THE INVENTION

The present invention relates generally to the data processing field,and more particularly, relates to a method and apparatus forimplementing predefined actions based upon packet classification andlookup results in a communications network processor.

DESCRIPTION OF THE RELATED ART

Network processing functions of a network processor must be performed ata high rate to avoid causing any bottleneck in the communicationsnetwork.

Network processing functions, such as the process of Ethernet bridging,routing, and filtering, typically are performed by software running on ageneral purpose processor, such as a PowerPC processor, or on a specialpurpose processor, such as an embedded picoprocessor. For example, inthe IBM NPe405H, the packet type recognition, table lookups andinterpretation of the results are all handled in software running on aPPC405 processor core. Another example is the IBM NP4GS3 where packettype recognition is done by a hard wired logic block, the table lookupsare done by a special purpose Tree Search Engine and the results areinterpreted by software running on a picoprocessor.

A need exists for an improved mechanism for interpreting the results ofpacket format recognition and table searches and performing actionsbased upon those results. It is desirable that such a mechanism isimplemented in hardware to minimize software usage and processoroverhead.

SUMMARY OF THE INVENTION

A principal object of the present invention is to provide a method andapparatus for implementing predefined actions based upon packetclassification and lookup results in a communications network processor.Other important objects of the present invention are to provide suchmethod and apparatus for implementing predefined actions based uponpacket classification and lookup results substantially without negativeeffect and that overcome many of the disadvantages of prior artarrangements.

In brief, a method and apparatus are provided for implementingpredefined actions based upon packet classification and lookup resultsin a communications network processor. A plurality of sets of rules isdefined. Each rule set includes at least one rule and each rule has aset of masked compares for comparing results of hits and misses of tablelookups. Each masked compare set has an associated field for selectingan action. The action defines a set of one or more commands and eachcommand defines a processing operation. One rule set is identified basedupon the packet classification result for a received packet. When one ofthe rules is identified having a match of the masked compares, then theaction of associated with the identified rule is selected.

In accordance with features of the invention, a default action isprovided responsive to no rule of the identified rule set having a matchof the masked compares. When a plurality of rules of the identified ruleset having a match of the masked compares is identified; and then one ofthe plurality of the rules having a highest priority is identified; andthe action of the identified rule having the highest priority isselected.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention together with the above and other objects andadvantages may best be understood from the following detaileddescription of the preferred embodiments of the invention illustrated inthe drawings, wherein:

FIG. 1 is a block diagram representation illustrating a networkprocessor system for implementing predefined actions based upon packetclassification and lookup results in accordance with the preferredembodiment;

FIG. 2 is a block diagram representation illustrating an exemplaryhardware implementation for performing the predefined actions in thenetwork processor system of FIG. 1 in accordance with the preferredembodiment;

FIG. 3 is a block diagram illustrating a rule set in accordance with thepreferred embodiment; and

FIG. 4 is a diagram illustrating exemplary logic of the hardwareimplementation of FIG. 2 for performing the predefined actions inaccordance with the preferred embodiment.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Having reference now to the drawings, in FIG. 1, there is shown anetwork processor system generally designated by the reference character100 for carrying out methods for implementing predefined actions basedupon packet classification and lookup results of the preferredembodiment. As shown in FIG. 1, network processor system 100 includes anetwork processor 102. Network processor system 100 includes a controlprocessor 104, and a dataflow processor 106 coupled by a networkprocessor bus to dataflow assist hardware (HW) 108 of the preferredembodiment. The dataflow assist hardware (HW) 108 of the preferredembodiment is coupled to multiple network ports #1-N 110 forcommunicating using known network protocols, such as, an AsynchronousTransfer Mode (ATM), Ethernet, and the like. Network processor system100 includes an input/output (I/O) 112 coupled to peripheral devices.Network processor system 100 includes a system memory 114 including adynamic random access memory (DRAM)

Network processor 102 can be implemented with various standardprocessors, for example, with one of the PowerPC® line of processorsmanufactured by International Business Machines Corporation.

In accordance with features of the preferred embodiment, dataflow assisthardware (HW) 108 includes a hardware mechanism 200, as illustrated anddescribed with respect to FIGS. 2, 3 and 4, for implementing predefinedactions based upon packet classification and lookup results. Thehardware mechanism of the preferred embodiment is used in the process ofrouting, filtering and/or decoding for protocol termination, packetsthat arrive on the ports of a processing node in a communicationsnetwork. The hardware mechanism of the preferred embodiment receives apacket type and table lookup results of a function that recognizespacket formats, builds lookup keys depending on the packet format andthen performs a series of table searches. The hardware mechanism of thepreferred embodiment interprets the results of the packet formatrecognition and table searches and performs actions based on thoseresults. The hardware mechanism of the preferred embodiment includes anefficient hardware implementation and flexibility in allowing functionslike Ethernet bridging and Internet Protocol (IP) filtering and routingto be performed by the same hardware.

In accordance with features of the preferred embodiment, a plurality ofrule sets is provided to determine how to interpret table lookup resultsand what actions to take based on those results. The rule set that isused is selected based upon the results of the packet format recognitionblock. For example, an IPV4 packet with no options in the header coulduse one rule set and an Address Resolution Protocol packet could useanother rule set. Each rule has a set of masked compares that look atthe combination of hits and misses from the table lookups. Each maskedcompare has a field associated with it that selects from a set ofcommands. For example, the commands specified by this invention include:

NOOP Produce default results. Discard Cause the packet to be discarded.Route Based on Route the packet based on information Search N pointed toby table lookup number N. IP Route Route the packet based on informationpointed to by the first Direct IP Routing table entry found. Turn thepacket over Force the packet to be handled by to Software running onsoftware. a processor of some type.

Referring now to FIG. 2, the dataflow assist hardware (HW) 108 is shownwith an exemplary hardware implementation of the hardware mechanism 200for performing the predefined actions in the network processor system100 in accordance with the preferred embodiment.

As shown in FIG. 2, the dataflow assist hardware (HW) 108 includes apacket format recognition function 202 that recognizes packet formats,and applies a packet type to the hardware mechanism 200. The packetformat recognition function 202 builds lookup keys depending on thepacket format for a table search function 204 coupled to a series oflookup tables 206. The table search function 204 performs a series oftable searches and applies table search results of hits and misses tothe hardware mechanism 200.

Hardware mechanism 200 includes a rule sets function 210 defining aplurality of sets of rules. A packet type control is applied to the rulesets function 210 for selecting one rule set based upon this packetclassification result for the received packet header.

Referring also to FIG. 3, an exemplary rule set generally designated bythe reference character 300 in accordance with the preferred embodimentis shown. As shown in FIG. 3, each rule has a set of masked compares forcomparing results of hits and misses of table lookups; and each maskedcompare has an associated field for selecting an action. The actiondefines a set of one or more commands with each command defining aprocessing operation, for example, as listed above.

Hardware mechanism 200 includes a masked compares function 212 receivingthe table lookup results of hits and misses for the table searchfunction 204. The masked compares function 212 receives the set ofmasked compares for each rule of the selected rule set for comparingresults of hits and misses of table lookups and the mask compares toidentify one rule of the selected rule set having a match of the maskedcompares and having a highest priority. For each rule of the selectedrule set, the set of masked compares includes a bit mask including anumber of bits related to the table lookup results. The bit maskincludes a pattern of bit values related to the table lookup results.For example, the pattern of bit values includes a 0 value correspondingto each don't care table lookup result and a 1 value corresponding to aselected table lookup result. Then a match of the masked compares andthe results of hits and misses of table lookups is identified where ahit results for each selected table lookup result where the mask bit isa 1 value.

Hardware mechanism 200 includes a rule selection function 214 thatreceives the identified highest priority compare from the maskedcompares function 212 and selects the action of associated with themasked compare of the identified rule. If none of the provided maskedcompares match the combination of table lookup hits and misses, adefault command as shown in rule set 300 is executed. For example, suchas the default command is one of the NOOP, Discard or Turn the packetover to Software commands that is executed when no match is found.

FIG. 4 illustrates exemplary logic for implementing the hardwaremechanism 200 for performing the predefined actions in accordance withthe preferred embodiment. The illustrated exemplary logic is providedand operated in parallel for each rule of the selected rule set, such asrule set 300. Hits from the results of the table lookups as indicated ina block 400 and the compare table lookup results of hits and misses asindicated in a block 402 are applied to a exclusive OR (XOR) gate 404that provides at its output miscompares or results that do not match. Abit mask for the rule as indicated in a block 406 and the miscomparesare ANDed by an AND gate 408 that provides at its output maskedmiscompares. The masked miscompares are applied to a NOR gate 410 toprovide a match at the output of NOR gate 410, if any. A priorityfunction 412 receives other matches from the hardware logic operating inparallel for other rules of the identified rule set for identifying thehighest priority match.

As an example, assume that the processing node is set up to do Ethernetswitching as determined by the packet format recognition function 202.The table search logic of table search function 204 is set up to dothree table searches of lookup tables 206, for example, as follows:

1. Look up the media access control (MAC) source address (SA) to see ifthe source of the packet is known.

2. Look up the MAC destination address (DA) to route the packet to itsdestination.

3. Look up the virtual local area network (VLAN) ID in case a broadcastis needed.

Exemplary masked-compare/command combinations used in accordance withthe preferred embodiment for this function is shown in TABLE 1:

TABLE 1 Hits Command Comment 0xx Turn the packet over to Software AllowMAC SA to be learned by adding it to MAC table 11x Route Based on Search2 Use the information stored in the MAC table to route 101 Route Basedon Search 3 Use the information store in the VLAN table to broad 100Turn the packet over to Allow software to inform the Software ControlPoint about an 100 NOOP not used

A second example would be IP routing with Differentiated Services overEthernet connections. Traditional frame routing capability provided innetwork processor devices typically utilize a network routing tablehaving entries which provide a single next hop for each table entry. Asknown in current Internet (network) packet routing protocols there maybe implemented Internet Protocol (IP) Differentiated Services (DiffServ)which define a type of packet communication service. The assumed tablesearch logic is set up to do up to four searches:

1. Look up the IP DA to find the Next Hop IP address.

2. If the first lookup returned an indirect address, use the indirectaddress to look up the true Next Hop IP address (Boundary GatewayProtocol).

3. Look up the Next Hop IP address in the ARP table to find the MAC DAof the next hop.

4. Do a Lookup based on the input Port number, IP, SA, IP, DA, and IPProtocol fields to find the Diffserv Flow ID.

Exemplary masked-compare/command combinations used in accordance withthe preferred embodiment for this function is shown in TABLE 2:

TABLE 2 Hits Command Comments 111x IP Route If the first search returnedan indirect address If Search 4 also got a hit Route the packet based onthe results of Search 2 Provide the results of search 3 as the MAC DAfor pkt Provide the results of search 4 as the Diffserv Flow ID ElsePerform default command Else Route the packet based on the results ofSearch 1 Provide the results of search 2 as the MAC DA for pkt Providethe results of search 3 as the Diffserv Flow ID Default Turn the packetSoftware may perform further lookups and/or over to routing, etc.Software

Filtering is done by setting up a search on at least one field andsetting the masked-compare/command combination to be a Discard if thatsearch returned a hit.

While the present invention has been described with reference to thedetails of the embodiments of the invention shown in the drawing, thesedetails are not intended to limit the scope of the invention as claimedin the appended claims.

1-7. (canceled)
 8. Apparatus for implementing predefined actions basedupon packet classification and table lookup results in dataflow assisthardware of a communications network processor, said apparatuscomprising: a plurality of rule sets, each rule set including at leastone rule, each said rule having a set of masked compares for comparingresults of hits and misses of table lookups; and each said maskedcompare having an associated field for selecting an action; said actiondefining a set of commands; each said command defining a processingoperation; logic for identifying one said rule set based upon the packetclassification result; a masked compares function for identifying onesaid rule of said identified rule set having a match of said maskedcompares and a highest priority; said masked compares function includeshardware logic operating in parallel for each said rule of saididentified rule set for identifying said match of said masked compares;and a rule selection function for selecting said action of saididentified one said rule.
 9. Apparatus for implementing predefinedactions based upon packet classification and table lookup results in acommunications network processor as recited in claim 8 wherein said ruleselection function selects a default action responsive to no rule ofsaid identified rule set having a match of said masked compares. 10.(canceled)
 11. Apparatus for implementing predefined actions based uponpacket classification and table lookup results in a communicationsnetwork processor as recited in claim 8 wherein said set of maskedcompares of each said rule includes include a bit mask including anumber of bits related to the table lookup results.
 12. Apparatus forimplementing predefined actions based upon packet classification andtable lookup results in a communications network processor as recited inclaim 11 wherein said bit mask includes a pattern of bit values relatedto the table lookup results.
 13. Apparatus for implementing predefinedactions based upon packet classification and table lookup results in acommunications network processor as recited in claim 12 wherein saidpattern of bit values includes a 0 value corresponding to each don'tcare table lookup result and a 1 value corresponding to a selected tablelookup result.
 14. Apparatus for implementing predefined actions basedupon packet classification and table lookup results in a communicationsnetwork processor as recited in claim 8 wherein said action definingsaid set of commands include commands for routing, filtering, anddecoding processing operations.